package nextee.cabletest.controller;

import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.TableView;
import nextee.cabletest.data.DeviceData;
import nextee.cabletest.db.CableData;

import java.net.URL;
import java.sql.SQLException;
import java.util.List;
import java.util.ResourceBundle;

/**
 * Created by ycj on 2015/3/28.
 */
public class ExceptDataController extends BaseController implements Initializable{
    @FXML
    private TableView except_data;

    @Override
    public void initialize(URL location, ResourceBundle resources) {
        List<CableData> cableDataList = null;
        try {
            MainController main = (MainController)resources.getObject("");
            cableDataList = main.getCableDataDao().queryForAll();
        } catch (SQLException e) {
            e.printStackTrace();
        }

        final ObservableList<CableData> data = FXCollections.observableList(cableDataList);

//        final ObservableList<DeviceData> data = FXCollections.observableArrayList(
//                new DeviceData("A1", 23.7, 3.14, "2015-03-28"),
//                new DeviceData("A2", 23.7, 8.37, "2015-04-23"),
//                new DeviceData("D4", 17.4, 1.44, "2015-05-05")
//                );

        except_data.setItems(data);
    }
}
